// src/main/java/com/example/player/control/ControlPanel.java
package com.example.control;

import com.example.command.Command;

/**
 * 控制面板类 (Invoker)
 * 负责绑定和执行命令
 */
public class ControlPanel {
    // 按钮命令引用
    private Command playCommand;
    private Command stopCommand;
    private Command pauseCommand;
    private Command seekCommand;

    // 绑定命令方法
    public void setPlayCommand(Command command) {
        this.playCommand = command;
    }

    public void setStopCommand(Command command) {
        this.stopCommand = command;
    }

    public void setPauseCommand(Command command) {
        this.pauseCommand = command;
    }

    public void setSeekCommand(Command command) {
        this.seekCommand = command;
    }

    // 用户操作方法
    public void clickPlay() {
        System.out.print("[UI] 点击播放按钮 → ");
        playCommand.execute();
    }

    public void clickStop() {
        System.out.print("[UI] 点击停止按钮 → ");
        stopCommand.execute();
    }

    public void clickPause() {
        System.out.print("[UI] 点击暂停按钮 → ");
        pauseCommand.execute();
    }

    public void clickSeek() {
        System.out.print("[UI] 拖动进度条 → ");
        seekCommand.execute();
    }
}
